﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using codefile;

namespace ArleneBarandGrill
{
    public partial class Form4 : Form
    {
        DataTable DTbl = new DataTable();
        Data ms = new Data();


        public Form4()
        {

            InitializeComponent();
            btnlogin.Click += new EventHandler(btnlogin_Click);
        }

        void btnlogin_Click(object sender, EventArgs e)
        {
            ms.connect();
            ms.querry("SELECT *FROM tblusers WHERE fUsername = '" + txtusername.Text + "' AND fPassword = '" + txtpassword.Text + "'");
            if (ms.DTbl.Rows.Count > 0)
            {

                MessageBox.Show("Successful");

                string pos = ms.DTbl.Rows[0]["fLevelOfAccess"].ToString();
                this.Hide();
                Form1 frm = new Form1();
                frm.manipulation(pos);

                frm.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("Invalid Username or Password");
                txtusername.Text = "";
                txtusername.Focus();
                txtpassword.Text = "";
            }
            ms.close();
        }
    }
}
